function Shell_Fox_elecavg_FEdemoshrt_grID_wtp_tomlab_varagin_j_bs(subsample,inc,set_seed,matlab_seed,get_nb_draws)

%matlab_seed=1353;
rng(matlab_seed)

	tmp_file1=strcat('/Users/shoude/Dropbox/eegap/EEgap_data_code_heter_SM/Data/Matlab_estimation/choiceset_identifier_trimester_week_zipcode_2008_2012_v11022017_struct_',num2str(subsample),'_',num2str(inc),'_seed_',num2str(set_seed),'.csv');
    id=load(tmp_file1); 
	Nmax=size(id,1);
    
	if subsample == 11000
		bs_max=10*ceil(Nmax/10000);
    elseif subsample == 44000
		bs_max=10*ceil(Nmax/20000); 
        %bs_max=20;
    end

 %While we are waiting the code to converge for the bs_max
    bs_max=16;

for j=1:bs_max
%parfor j=1:bs_max	
	if subsample == 11000
		index_bs=[(1+(j-1)*(1000)):min(j*(1000),Nmax)];
    elseif subsample == 44000
		index_bs=[(1+(j-1)*(2000)):min(j*(2000),Nmax)];
	end
		try	
			%result_mixed=strcat('\\c3\rdat\SHoude\Research/sears/estar_results/struct_est/','mixed_logit_FEdemoshrt_grID_wtp_100iters_',num2str(subsample),'_',num2str(inc),'_',num2str(set_seed),'_matlab_seed_',num2str(matlab_seed),'_nb_draws_',num2str(get_nb_draws),'bs_',num2str(j),'.mat');
			%eval(['load ' result_mixed]);
            %j
			Master_Fox_elecavg_FEdemoshrt_3param_grID_wtp_j_bs(subsample,inc,set_seed,matlab_seed,get_nb_draws, j, index_bs)
            j
        catch
			display('BS iteration crached')
		end

	end

end

